package edu.hawaii.duedates.messenger;

import java.io.Serializable;

/**
 * This interface is implemented by all messengers. It defines accessor, mutator, and toString
 * behaviors.
 * 
 * @author Ronn Reeves and Robin E. Raqueno
 */
public interface IMessenger extends Serializable {

  /**
   * Valid message options for the Messenger class.
   */
  public enum MessageType {
    /** Help and usage message. */
    HELP,

    /** Invalid email parameter provided. */
    INVALID_EMAIL_PARAMETER,

    /** Invalid library or user parameters provided. */
    INVALID_QUERY_PARAMETERS,

    /** No library or user parameters provided. */
    MISSING_QUERY_PARAMETERS,

    /** Querying libraries message. */
    REQUEST_DATA,

    /** Simple message output. */
    SIMPLE,

    /** Stack trace. */
    STACK_TRACE,

    /** XML File Error. */
    XML_FILE_ERROR,

    /** Welcome message. */
    WELCOME;
  }

  /**
   * Valid output options for the Messenger class.
   */
  public enum OutputType {

    /** Output to the console. */
    CONSOLE,

    /** Output to email. */
    EMAIL;
  }

  /**
   * Appends message to this messenger.
   * 
   * @param msg The message type being appended.
   */
  public void append(MessageType msg);

  /**
   * Appends message to this messenger.
   * 
   * @param msg The message type being appended.
   * @param additionalInfo Additional information to append to the message.
   */
  public void append(MessageType msg, String additionalInfo);

  /**
   * Appends the stack trace to the messenger.
   * 
   * @param e The exception providing the stack trace.
   */
  public void appendStackTrace(Exception e);

  /**
   * Returns the message of this messenger.
   * 
   * @return String The book title.
   */
  public String getMessage();

  /**
   * Returns the output form of this messenger.
   * 
   * @return Output The output format.
   */
  public OutputType getOutFormat();

  /**
   * Returns true if this messenger has verbose output; false otherwise.
   * 
   * @return Boolean The verbose setting.
   */
  public Boolean isVerbose();

  /**
   * Reports the messenge of this messenger to the console.
   */
  public void report();

  /**
   * Reports the messenge of this messenger to an email account.
   * 
   * @param emailAccount The user email account to send message.
   * @param smtpServer The SMTP mail server target.
   */
  public void report(String emailAccount, String smtpServer);

  /**
   * Sets the out format of this messenger.
   * 
   * @param option The output format.
   */
  public void setOutFormat(OutputType option);

  /**
   * Sets the verbosity of this messenger.
   * 
   * @param verbose The verbose setting.
   */
  public void setVerbose(Boolean verbose);

  /**
   * Returns the title of this book.
   * 
   * @return String The book title.
   */
  public String toString();
}